﻿using FPSO.Models.Domain;
using FPSO.Services.Utils;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace FPSO.Services.Impl
{
    public class DBInstructService : DbRepository<InstructLog>, IInstructService
    {
        public void AddInstructLog(InstructLog insLog)
        {
            InsertEntity(insLog);
        }

        public List<InstructLog> GetActiveInstracts()
        {
            return QueryListByCondition("ins_state IN (0,1,2)");
        }

        public InstructLog GetInstractByInsId(int insId)
        {
            return QueryEntity(l => l.InsId == insId);
        }

        public InstructLog GetInstractByTaskId(int taskId)
        {
            return QueryEntity(l => l.TaskId == taskId);
        }

        public void UpdateInstructLog(InstructLog insLog)
        {
            UpdateEntity(insLog);
        }
    }
}
